import java.util.Random;

public class Tets8 {
    public static void main(String[] args) {
        int[] arr = {2, 588, 888, 1000, 10000};
        int[] newAarr = new int[arr.length];
        Random random = new Random();
        for (int i = 0; i < 5; ) {
            int index = random.nextInt(arr.length);
            int ret = arr[index];
            if ((fun(newAarr, ret)) == 0) {
                newAarr[i++] = ret;
            }
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.print(newAarr[i] + " ");
        }
    }

    public static int fun(int[] arr, int ret) {
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == ret)
                return 1;
        }
        return 0;
    }
}
